#include <iostream>
#include "CircularQueue.h"

int main() {
    // 创建一个容量为5的环形队列
    CircularQueue<int> queue(5);


    // 测试入队操作
    std::cout << "Enqueue elements: ";
    for (int i = 1; i <= 6; ++i) {
        if (queue.enqueue(i)) {
            std::cout << i << " ";
        } else {
            std::cout << "Queue is full, cannot enqueue " << i << std::endl;
        }
    }
    std::cout << std::endl;

    // 检查队列是否已满
    std::cout << "Is the queue full? " << (queue.full_queue() ? "Yes" : "No") << std::endl;

    // 查看队首和队尾元素
    int front, back;
    if (queue.front(front)) {
        std::cout << "Front element: " << front << std::endl;
    }
    if (queue.back(back)) {
        std::cout << "Back element: " << back << std::endl;
    }

    // 测试出队操作
    std::cout << "Dequeue elements: ";
    while (!queue.empty()) {
        if (queue.dequeue(front)) {
            std::cout << front << " ";
        }
    }
    std::cout << std::endl;

    // 再次入队操作
    std::cout << "Re-enqueue elements: ";
    for (int i = 7; i <= 9; ++i) {
        if (queue.enqueue(i)) {
            std::cout << i << " ";
        } else {
            std::cout << "Queue is full, cannot enqueue " << i << std::endl;
        }
    }
    std::cout << std::endl;

    // 查看当前队列大小
    std::cout << "Current queue size: " << queue.size() << std::endl;

    return 0;
}
